/**
 * Copyright 2010-2011 Nicholas Blair, Eric Dalquist
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.googlecode.ehcache.annotations.config;



/**
 * @author Eric Dalquist
 * @version $Revision: 656 $
 */
public class InterceptorTestImpl implements InterceptorTestInterface {
    private int interfaceAnnotatedCachedThrows = 0;
    private int interfaceAnnotatedCached = 0;
    private int interfaceAnnotatedExceptionCachedThrows = 0;
    private int interfaceAnnotatedExceptionCached = 0;
    private int interfaceAnnotatedCachedInterceptorThrows = 0;
    private int interfaceAnnotatedCachedInterceptor = 0;
    private int interfaceAnnotatedExceptionCachedInterceptorThrows = 0;
    private int interfaceAnnotatedExceptionCachedInterceptor = 0;
    

    public String interfaceAnnotatedCached(boolean throwsException) {
        if (throwsException) {
            this.interfaceAnnotatedCachedThrows++;
            throw new RuntimeException("throwsException was true");
        }
        
        this.interfaceAnnotatedCached++;
        return "interfaceAnnotatedCached(" + throwsException + ")";
    }
    public int interfaceAnnotatedCachedCount() {
        return interfaceAnnotatedCached;
    }
    public int interfaceAnnotatedCachedThrowsCount() {
        return interfaceAnnotatedCachedThrows;
    }

    public String interfaceAnnotatedExceptionCached(boolean throwsException) {
        if (throwsException) {
            this.interfaceAnnotatedExceptionCachedThrows++;
            throw new RuntimeException("throwsException was true");
        }
        
        this.interfaceAnnotatedExceptionCached++;
        return "interfaceAnnotatedExceptionCached(" + throwsException + ")";
    }
    public int interfaceAnnotatedExceptionCachedCount() {
        return interfaceAnnotatedExceptionCached;
    }
    public int interfaceAnnotatedExceptionCachedThrowsCount() {
        return interfaceAnnotatedExceptionCachedThrows;
    }

    public String interfaceAnnotatedTriggersRemove(int argument) {
        return "interfaceAnnotatedTriggersRemove(" + argument + ")";
    }

    public String interfaceAnnotatedTriggersRemoveAll(int argument) {
        return "interfaceAnnotatedTriggersRemoveAll(" + argument + ")";
    }

    public String interfaceAnnotatedCachedInterceptor(boolean throwsException) {
        if (throwsException) {
            this.interfaceAnnotatedCachedInterceptorThrows++;
            throw new RuntimeException("throwsException was true");
        }
        
        this.interfaceAnnotatedCachedInterceptor++;
        return "interfaceAnnotatedCachedInterceptor(" + throwsException + ")";
    }
    public int interfaceAnnotatedCachedInterceptorCount() {
        return interfaceAnnotatedCachedInterceptor;
    }
    public int interfaceAnnotatedCachedInterceptorThrowsCount() {
        return interfaceAnnotatedCachedInterceptorThrows;
    }

    public String interfaceAnnotatedExceptionCachedInterceptor(boolean throwsException) {
        if (throwsException) {
            this.interfaceAnnotatedExceptionCachedInterceptorThrows++;
            throw new RuntimeException("throwsException was true");
        }
        
        this.interfaceAnnotatedExceptionCachedInterceptor++;
        return "interfaceAnnotatedExceptionCachedInterceptor(" + throwsException + ")";
    }

    public int interfaceAnnotatedExceptionCachedInterceptorCount() {
        return interfaceAnnotatedExceptionCachedInterceptor;
    }

    public int interfaceAnnotatedExceptionCachedInterceptorThrowsCount() {
        return interfaceAnnotatedExceptionCachedInterceptorThrows;
    }

    public String interfaceAnnotatedTriggersRemoveInterceptor(int argument) {
        return "interfaceAnnotatedTriggersRemoveInterceptor(" + argument + ")";
    }

    public String interfaceAnnotatedTriggersRemoveAllInterceptor(int argument) {
        return "interfaceAnnotatedTriggersRemoveAllInterceptor(" + argument + ")";
    }
}
